<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>iic: Main Page</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">iic
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li class="current"><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="pages.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('index.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">iic Documentation</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><a class="el" href="struct_x_iic.html" title="The XIic driver instance data. ">XIic</a> is the driver for an IIC master or slave device.In order to reduce the memory requirements of the driver the driver is partitioned such that there are optional parts of the driver. Slave, master, and multimaster features are optional such that all these files are not required at the same time. In order to use the slave and multimaster features of the driver, the user must call functions (XIic_SlaveInclude and XIic_MultiMasterInclude) to dynamically include the code. These functions may be called at any time.</p>
<p>Two sets of higher level API's are available in the <a class="el" href="struct_x_iic.html" title="The XIic driver instance data. ">XIic</a> driver that can be used for Transmission/Reception in Master mode :</p>
<ul>
<li><a class="el" href="group___overview.html#ga977382e8a20bd5e690229f82af2e7603" title="This function sends data as a master on the IIC bus. ">XIic_MasterSend()</a>/ <a class="el" href="group___overview.html#ga337bf0d322d4a7d9b4f8baa30e00ab45" title="This function receives data as a master from a slave device on the IIC bus. ">XIic_MasterRecv()</a> which is used in normal mode.</li>
<li><a class="el" href="group___overview.html#gac4c6388d0db3b08ddcd47f0b2459ff3c" title="This function sends data as a Dynamic master on the IIC bus. ">XIic_DynMasterSend()</a>/ <a class="el" href="group___overview.html#ga4d7985d95cd029ab0b0f2a5ccc614793" title="This function receives data as a master from a slave device on the IIC bus. ">XIic_DynMasterRecv()</a> which is used in Dynamic mode.</li>
</ul>
<p>Similarly two sets of lower level API's are available in <a class="el" href="struct_x_iic.html" title="The XIic driver instance data. ">XIic</a> driver that can be used for Transmission/Reception in Master mode:</p>
<ul>
<li><a class="el" href="group___overview.html#ga907c577b53407fb0bfc98d0ca37ee221" title="Send data as a master on the IIC bus. ">XIic_Send()</a>/ <a class="el" href="group___overview.html#ga7a848238d75ff57837afa5a58f11f326" title="Receive data as a master on the IIC bus. ">XIic_Recv()</a> which is used in normal mode</li>
<li><a class="el" href="group___overview.html#gadeaf11cda2466ae1c6036a3de0f52874" title="Send data as a master on the IIC bus. ">XIic_DynSend()</a>/ <a class="el" href="group___overview.html#ga9979fbd483e1c8c495c9eb2bfd7ad6e9" title="Receive data as a master on the IIC bus. ">XIic_DynRecv()</a> which is used in Dynamic mode.</li>
</ul>
<p>The user should use a single set of APIs as per his requirement and should not intermix them.</p>
<p>All the driver APIs can be used for read, write and combined mode of operations on the IIC bus.</p>
<p>In the normal mode IIC support both 7-bit and 10-bit addressing, and in the dynamic mode support only 7-bit addressing.</p>
<p><b>Initialization &amp; Configuration</b></p>
<p>The <a class="el" href="struct_x_iic___config.html" title="This typedef contains configuration information for the device. ">XIic_Config</a> structure is used by the driver to configure itself. This configuration structure is typically created by the tool-chain based on HW build properties.</p>
<p>To support multiple runtime loading and initialization strategies employed by various operating systems, the driver instance can be initialized in one of the following ways:</p>
<ul>
<li><a class="el" href="group___overview.html#gad36c610ec3139cef71f3795f9ce81308" title="Initializes a specific XIic instance. ">XIic_Initialize()</a> - The driver looks up its own configuration structure created by the tool-chain based on an ID provided by the tool-chain.</li>
<li><a class="el" href="group___overview.html#ga301f08e1fa6e74bf4c2885702bf0ff70" title="Initializes a specific XIic instance. ">XIic_CfgInitialize()</a> - The driver uses a configuration structure provided by the caller. If running in a system with address translation, the provided virtual memory base address replaces the physical address present in the configuration structure.</li>
</ul>
<p><b>General Purpose Output</b> The IIC hardware provides a General Purpose Output Register that allows the user to connect general purpose outputs to devices, such as a write protect, for an EEPROM. This register is parameterizable in the hardware such that there could be zero bits in this register and in this case it will cause a bus error if read or written.</p>
<p><b>Bus Throttling</b></p>
<p>The IIC hardware provides bus throttling which allows either the device, as either a master or a slave, to stop the clock on the IIC bus. This feature allows the software to perform the appropriate processing for each interrupt without an unreasonable response restriction. With this design, it is important for the user to understand the implications of bus throttling.</p>
<p><b>Repeated Start</b></p>
<p>An application can send multiple messages, as a master, to a slave device and re-acquire the IIC bus each time a message is sent. The repeated start option allows the application to send multiple messages without re-acquiring the IIC bus for each message. The transactions involving repeated start are also called combined transfers if there is Read and Write in the same transaction.</p>
<p>The repeated start feature works with all the API's in <a class="el" href="struct_x_iic.html" title="The XIic driver instance data. ">XIic</a> driver.</p>
<p>The Repeated Start feature also could cause the application to lock up, or monopolize the IIC bus, should repeated start option be enabled and sequences of messages never end(periodic data collection). Also when repeated start is not disable before the last master message is sent or received, will leave the bus captive to the master, but unused.</p>
<p><b>Addressing</b></p>
<p>The IIC hardware is parameterized such that it can be built for 7 or 10 bit addresses. The driver provides the ability to control which address size is sent in messages as a master to a slave device. The address size which the hardware responds to as a slave is parameterized as 7 or 10 bits but fixed by the hardware build.</p>
<p>Addresses are represented as hex values with no adjustment for the data direction bit as the software manages address bit placement. This is especially important as the bit placement is not handled the same depending on which options are used such as repeated start and 7 vs 10 bit addressing.</p>
<p><b>Data Rates</b></p>
<p>The IIC hardware is parameterized such that it can be built to support data rates from DC to 400KBit. The frequency of the interrupts which occur is proportional to the data rate.</p>
<p><b>Polled Mode Operation</b></p>
<p>This driver does not provide a polled mode of operation primarily because polled mode which is non-blocking is difficult with the amount of interaction with the hardware that is necessary.</p>
<p><b>Interrupts</b></p>
<p>The device has many interrupts which allow IIC data transactions as well as bus status processing to occur.</p>
<p>The interrupts are divided into two types, data and status. Data interrupts indicate data has been received or transmitted while the status interrupts indicate the status of the IIC bus. Some of the interrupts, such as Not Addressed As Slave and Bus Not Busy, are only used when these specific events must be recognized as opposed to being enabled at all times.</p>
<p>Many of the interrupts are not a single event in that they are continuously present such that they must be disabled after recognition or when undesired. Some of these interrupts, which are data related, may be acknowledged by the software by reading or writing data to the appropriate register, or must be disabled. The following interrupts can be continuous rather than single events.</p>
<ul>
<li>Data Transmit Register Empty/Transmit FIFO Empty</li>
<li>Data Receive Register Full/Receive FIFO</li>
<li>Transmit FIFO Half Empty</li>
<li>Bus Not Busy</li>
<li>Addressed As Slave</li>
<li>Not Addressed As Slave</li>
</ul>
<p>The following interrupts are not passed directly to the application through the status callback. These are only used internally for the driver processing and may result in the receive and send handlers being called to indicate completion of an operation. The following interrupts are data related rather than status.</p>
<ul>
<li>Data Transmit Register Empty/Transmit FIFO Empty</li>
<li>Data Receive Register Full/Receive FIFO</li>
<li>Transmit FIFO Half Empty</li>
<li>Slave Transmit Complete</li>
</ul>
<p><b>Interrupt To Event Mapping</b></p>
<p>The following table provides a mapping of the interrupts to the events which are passed to the status handler and the intended role (master or slave) for the event. Some interrupts can cause multiple events which are combined together into a single status event such as XII_MASTER_WRITE_EVENT and XII_GENERAL_CALL_EVENT </p>
<pre>
Interrupt                         Event(s)                      Role</pre><pre>Arbitration Lost Interrupt        XII_ARB_LOST_EVENT            Master
Transmit Error                    XII_SLAVE_NO_ACK_EVENT        Master
IIC Bus Not Busy                  XII_BUS_NOT_BUSY_EVENT        Master
Addressed As Slave                XII_MASTER_READ_EVENT,        Slave
                                  XII_MASTER_WRITE_EVENT,       Slave
                                  XII_GENERAL_CALL_EVENT        Slave
</pre><p> <b>Not Addressed As Slave Interrupt</b></p>
<p>The Not Addressed As Slave interrupt is not passed directly to the application through the status callback. It is used to determine the end of a message being received by a slave when there was no stop condition (repeated start). It will cause the receive handler to be called to indicate completion of the operation.</p>
<p><b>RTOS Independence</b></p>
<p>This driver is intended to be RTOS and processor independent. It works with physical addresses only. Any needs for dynamic memory management, threads or thread mutual exclusion, virtual memory, or cache control must be satisfied by the layer above this driver.</p>
<pre>
MODIFICATION HISTORY:</pre><pre>Ver   Who  Date     Changes
</p>
<hr/>
<p>
1.01a rfp  10/19/01 release
1.01c ecm  12/05/02 new rev
1.01d jhl  10/08/03 Added general purpose output feature
1.01d sv   05/09/05 Changed the data being written to the Address/Control
                    Register and removed the code for testing the
                    Receive Data Register in XIic_SelfTest function of
                    <a class="el" href="xiic__selftest_8c.html">xiic_selftest.c</a> source file
1.02a jvb  12/14/05 I separated dependency on the static config table and
                    xparameters.h from the driver initialization by moving
                    _Initialize and _LookupConfig to _sinit.c. I also added
                    the new _CfgInitialize routine.
1.02a mta  03/09/06 Added a new function XIic_IsIicBusy() which returns
                whether IIC Bus is Busy or Free.
1.02a mta  03/09/06 Implemented Repeated Start in the Low Level Driver.
1.03a mta  07/17/06 Added files to support Dynamic IIC controller in High
              level driver. Added <a class="el" href="xiic__dyn__master_8c.html">xiic_dyn_master.c</a>. Added support
                      for IIC Dynamic controller in Low level driver in <a class="el" href="xiic__l_8c.html">xiic_l.c</a>
1.13a wgr  03/22/07 Converted to new coding style.
1.13b ecm  11/29/07 added BB polling loops to the DynSend and DynRecv
              routines to handle the race condition with BNB in IISR.
1.14a sdm  08/22/08 Removed support for static interrupt handlers from the MDD
              file
1.14a ecm  11/13/08 changed BB polling loops in DynRecv to handle race
              condition, CR491889. DynSend was correct from v1.13.b
1.15a ktn  02/17/09 Fixed <a class="el" href="group___overview.html#ga3e8f77e5df8d92a4b27627e03b5e1807" title="This function gets the addresses for the IIC device driver. ">XIic_GetAddress()</a> to return correct device address.
1.16a ktn  07/17/09 Updated the <a class="el" href="group___overview.html#ga0a4d9b646c26bcf932561699d69d52b1" title="Runs a limited self-test on the driver/device. ">XIic_SelfTest()</a> to test only Interrupt
              Registers.
2.00a ktn  10/22/09 Converted all register accesses to 32 bit access.,
              Removed the macro XIIC_RESET, XIic_Reset API should be
              used in its place.
              Removed the XIIC_CLEAR_STATS macro, XIic_ClearStats API
              should be used in its place.
              Removed the macro XIic_mEnterCriticalRegion,
              XIic_IntrGlobalDisable should be used in its place.
              Removed the macro XIic_mExitCriticalRegion,
              XIic_IntrGlobalEnable should be used in its place.
              Some of the macros have been renamed to remove _m from
              the name see the <a class="el" href="xiic__i_8h.html">xiic_i.h</a> and <a class="el" href="xiic__l_8h.html">xiic_l.h</a> file for further
              information (Example XIic_mClearIntr is now
              XIic_ClearIntr).
              Some of the macros have been renamed to be consistent,
              see the <a class="el" href="xiic__l_8h.html">xiic_l.h</a> file for further information
              (Example XIIC_WRITE_IIER is renamed as XIic_WriteIier).
              The driver has been updated to use the HAL APIs/macros
              (Example XASSERT_NONVOID is now Xil_AssertNonvoid)
2.01a ktn  04/09/10 Updated TxErrorhandler in <a class="el" href="xiic__intr_8c.html">xiic_intr.c</a> to be called for
              Master Transmitter case based on Addressed As Slave (AAS)
              bit rather than MSMS bit(CR 540199).
2.02a sdm  10/08/10 Updated to disable the device at the end of the transfer,
              using Addressed As Slave (AAS) bit when addressed as
              slave in XIic_Send for CR565373.
2.03a rkv  01/25/11 Updated in NAAS interrupt handler to support data
              received less than FIFO size prior to NAAS interrupt.
              Fixed for CR590212.
2.04a sdm  07/22/11 Added IsSlaveSetAckOff flag to the instance structure.
              This flag is set when the Slave has set the Ack Off in the
              RecvSlaveData function (<a class="el" href="xiic__slave_8c.html">xiic_slave.c</a>) and
              is cleared in the NotAddrAsSlaveHandler (<a class="el" href="xiic__slave_8c.html">xiic_slave.c</a>)
              when the master has released the bus. This flag is
              to be used by slave applications for recovering when it
              has gone out of sync with the master for CR 615004.
              Removed a compiler warning in XIic_Send (<a class="el" href="xiic__l_8c.html">xiic_l.c</a>)
2.05a bss  02/05/12 Assigned RecvBufferPtr in XIic_MasterSend API and
              SendBufferPtr in XIic_MasterRecv to NULL in <a class="el" href="xiic__master_8c.html">xiic_master.c</a>
2.06a bss  02/14/13 Modified TxErrorHandler in <a class="el" href="xiic__intr_8c.html">xiic_intr.c</a> to fix CR #686483
              Modified <a class="el" href="xiic__eeprom__example_8c.html" title="This file consists of a Interrupt mode design example which uses the Xilinx IIC device and XIic drive...">xiic_eeprom_example.c</a> to fix CR# 683509.
              Modified bitwise OR to logical OR in
              XIic_InterruptHandler API in <a class="el" href="xiic__intr_8c.html">xiic_intr.c</a>.
2.07a adk  18/04/13 Updated the code to avoid unused variable warnings
                    when compiling with the -Wextra -Wall flags.
                    Changes done in files <a class="el" href="xiic_8c.html">xiic.c</a> and <a class="el" href="xiic__i_8h.html">xiic_i.h</a>. CR:705001
2.08a adk  29/07/13 In Low level driver In repeated start condition the
              Direction of Tx bit must be disabled in recv condition
              It Fixes the CR:685759 Changes are done in the file
              <a class="el" href="xiic__l_8c.html">xiic_l.c</a> in the function XIic_Recv.
3.0   adk  19/12/13 Updated as per the New Tcl API's
3.1   adk  01/08/15 When configured as a slave return the actual number of
                    bytes have been received/sent by the Master
                    to the user callback (CR: 828504). Changes are made in the
              file <a class="el" href="xiic__slave_8c.html">xiic_slave.c</a>.
3.2   sk   11/10/15 Used UINTPTR instead of u32 for Baseaddress CR# 867425.
                    Changed the prototype of XIic_CfgInitialize API.
3.2     sd   18/02/16 In Low level driver in repeated start condition
                    NACK for last byte is added. Changes are done in
                    XIic_Recv for CR# 862303
3.3   sk   06/17/16 Added bus busy checks for slave send/recv and master
                    send/recv.
3.3   als  06/27/16 XIic_IsIicBusy now a wrapper for XIic_CheckIsBusBusy.
3.4   ms   01/23/17 Added xil_printf statement in main function for all
                    examples to ensure that "Successfully ran" and "Failed"
                    strings are available in all examples. This is a fix
                    for CR-965028.
      ms   03/17/17 Added readme.txt file in examples folder for doxygen
                    generation.
      ms   04/05/17 Modified Comment lines in functions of iic
                    examples to recognize it as documentation block
                    for doxygen generation.
3.10  gm   07/09/23 Added SDT support.
</pre> </div></div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
